namespace tools {

	let imgRtt: eui.Image = null;//旋转图片
	let errGrp: eui.Group = null;//错误文字
	let delayItvl: number = null;//延迟显示计时器
	let inited: boolean = false;

	export let cover = {

		_init: () => {
			if (inited) return;
			else {
				inited = true;
				ui.setFull(ui.newRect({ alpha: 0.9, color: Color.BLACK }), game.layer.cover);
				errGrp = ui.setCenter(new eui.Group(), game.layer.cover);
				errGrp.maxWidth = ui.getStageWidth() - 100;
				ui.setFull(ui.createImg('frm_dark_red', { x: 10, y: 5, w: 24, h: 11 }), errGrp);
				let lbl = ui.newLbl('', { color: 0xFF2222, size: 36 });
				lbl.name = 'errLbl';
				ui.setAlign(lbl, { ver: 14, hor: 14 }, errGrp);
				// imgRtt = ui.setCenter(ui.newImg('img_rotate'), game.layer.cover);
				// effect.toRotate(imgRtt, { duration: 1, clockwise: false });
				errGrp.visible = false;
				game.layer.cover.visible = false;
			}
		},

		show: (text?: string, color?: number) => {
			cover._init();
			if (text) {
				let errLbl = errGrp.getChildByName('errLbl') as eui.Label;
				errLbl.text = text;
				if (numeric(color)) errLbl.textColor = color;
				errGrp.visible = true;
			} else errGrp.visible = false;
			game.layer.cover.visible = true;
		},

		hide: () => {
			cover._init();
			game.layer.cover.visible = false;
		}

	}
}